package com.ls.pattern.decorator.demo;

import java.util.List;

/**
 * 优惠券抵扣装饰器
 */
public class PriceCouponDeductionDecorator extends PriceCalculateDecorator {

    public PriceCouponDeductionDecorator(PriceCalculate priceCalculate) {
        super(priceCalculate);
    }

    @Override
    public Long discountPrice(List<Product> products) {
        Long originPrice = priceCalculate.calculatePrice(products);
        // 优惠券抵扣（此处为简化，实际应该从优惠券服务获取优惠券抵扣金额）
        return Math.max(originPrice - 5000, 0);
    }
}
